---
- name: Check if volta is installed
  ansible.builtin.command: command -v volta
  register: volta_exists
  ignore_errors: true
  changed_when: false
  tags:
    - nodejs

- name: Download Installer
  when: volta_exists is failed
  ansible.builtin.get_url:
    url: https://get.volta.sh
    dest: /tmp/get.volta.sh
    mode: "0755"
    force: "yes"
  tags:
    - nodejs

- name: Install volta
  when: volta_exists is failed
  ansible.builtin.command: /tmp/get.volta.sh
  register: result
  ignore_errors: true
  tags:
    - nodejs
